]> dgit.raspbian.org Git - gnome-shell.git/commit
dateMenu: Align time strings in the World Clocks section
authorMaksym Hazevych <dpadar@protonmail.com>
Sat, 7 May 2022 15:27:08 +0000 (18:27 +0300)
committerMarge Bot <marge-bot@gnome.org>
Wed, 18 May 2022 14:59:02 +0000 (14:59 +0000)
commit3290ef4eb662ddd8325afb66346f238fc22f2d14
treed87dff26f8f77a2dbc178b7356fc05572f4f7e82
parent0f4c64354c5baf72a42f9b0b5b52902f7af7474b
dateMenu: Align time strings in the World Clocks section

The problem is that " 9:59 AM" (notice the space at the beginning) and
"12:59 AM" strings, when centred, look misaligned —
strings padded with a space look off to the right by nearly
half a character. This happens because the font feature "tnum",
used to make numbers monospace, doesn't work on spaces.

The commit overcomes this by aligning time labels to the end.
However, this won't work for locales with AM/PM strings of different
lengths, so they are aligned to the start instead to minimise offset.

It's too complex to know whether the used locale has different
AM/PM string lengths. Instead, every time the time changes, it
determines whether all the time labels have the same amount of characters.

Fixes #5438

Part-of: <https://gitlab.gnome.org/GNOME/gnome-shell/-/merge_requests/2294>
js/ui/dateMenu.js